
/*
    Software License

    Copyright (C) 2021-05-24  Xoronos

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, version 3.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <https://www.gnu.org/licenses/>.
*/

/*
    Liabilities

    The software is provided "AS IS" without any warranty of any kind, either expressed,
    implied, or statutory, including, but not limited to, any warranty that the software
    will conform to specifications, any implied warranties of merchantability, fitness
    for a particular purpose, and freedom from infringement, and any warranty that the
    documentation will conform to the software, or any warranty that the software will
    be error free.

    In no event shall Xoronos be liable for any damages, including, but not limited to,
    direct, indirect, special or consequential damages, arising out of, resulting from,
    or in any way connected with this software, whether or not based upon warranty,
    contract, tort, or otherwise, whether or not injury was sustained by persons or
    property or otherwise, and whether or not loss was sustained from, or arose out of
    the results of, or use of, the software or services provided hereunder.

    To request the provided software under a different license you can contact us at
    support@xoronos.com
*/

#include "confgen.h"

#ifndef XRN_SKIP_CONFIGURATION_PROMPT
#define XRN_SKIP_CONFIGURATION_PROMPT 0
#endif

int confgen( FILE * permutation_settings_fp, FILE * encoding_settings_fp
 )
{

    uint64_t permutation_rnd[4];
    uint64_t encoding_rnd[4];

    int ret;

    ( ( uint8_t * ) & permutation_rnd[0] )[0] = 71;
    ( ( uint8_t * ) & permutation_rnd[0] )[1] = 206;
    ( ( uint8_t * ) & permutation_rnd[0] )[2] = 54;
    ( ( uint8_t * ) & permutation_rnd[0] )[3] = 134;
    ( ( uint8_t * ) & permutation_rnd[0] )[4] = 133;
    ( ( uint8_t * ) & permutation_rnd[0] )[5] = 244;
    ( ( uint8_t * ) & permutation_rnd[0] )[6] = 84;
    ( ( uint8_t * ) & permutation_rnd[0] )[7] = 178;
    ( ( uint8_t * ) & permutation_rnd[0] )[8] = 234;
    ( ( uint8_t * ) & permutation_rnd[0] )[9] = 176;
    ( ( uint8_t * ) & permutation_rnd[0] )[10] = 197;
    ( ( uint8_t * ) & permutation_rnd[0] )[11] = 95;
    ( ( uint8_t * ) & permutation_rnd[0] )[12] = 109;
    ( ( uint8_t * ) & permutation_rnd[0] )[13] = 248;
    ( ( uint8_t * ) & permutation_rnd[0] )[14] = 173;
    ( ( uint8_t * ) & permutation_rnd[0] )[15] = 96;
    ( ( uint8_t * ) & permutation_rnd[0] )[16] = 90;
    ( ( uint8_t * ) & permutation_rnd[0] )[17] = 3;
    ( ( uint8_t * ) & permutation_rnd[0] )[18] = 164;
    ( ( uint8_t * ) & permutation_rnd[0] )[19] = 218;
    ( ( uint8_t * ) & permutation_rnd[0] )[20] = 94;
    ( ( uint8_t * ) & permutation_rnd[0] )[21] = 125;
    ( ( uint8_t * ) & permutation_rnd[0] )[22] = 22;
    ( ( uint8_t * ) & permutation_rnd[0] )[23] = 98;
    ( ( uint8_t * ) & permutation_rnd[0] )[24] = 233;
    ( ( uint8_t * ) & permutation_rnd[0] )[25] = 149;
    ( ( uint8_t * ) & permutation_rnd[0] )[26] = 247;
    ( ( uint8_t * ) & permutation_rnd[0] )[27] = 170;
    ( ( uint8_t * ) & permutation_rnd[0] )[28] = 59;
    ( ( uint8_t * ) & permutation_rnd[0] )[29] = 133;
    ( ( uint8_t * ) & permutation_rnd[0] )[30] = 55;
    ( ( uint8_t * ) & permutation_rnd[0] )[31] = 17;

    ( ( uint8_t * ) & encoding_rnd[0] )[0] = 171;
    ( ( uint8_t * ) & encoding_rnd[0] )[1] = 66;
    ( ( uint8_t * ) & encoding_rnd[0] )[2] = 5;
    ( ( uint8_t * ) & encoding_rnd[0] )[3] = 34;
    ( ( uint8_t * ) & encoding_rnd[0] )[4] = 203;
    ( ( uint8_t * ) & encoding_rnd[0] )[5] = 24;
    ( ( uint8_t * ) & encoding_rnd[0] )[6] = 184;
    ( ( uint8_t * ) & encoding_rnd[0] )[7] = 79;
    ( ( uint8_t * ) & encoding_rnd[0] )[8] = 244;
    ( ( uint8_t * ) & encoding_rnd[0] )[9] = 146;
    ( ( uint8_t * ) & encoding_rnd[0] )[10] = 97;
    ( ( uint8_t * ) & encoding_rnd[0] )[11] = 95;
    ( ( uint8_t * ) & encoding_rnd[0] )[12] = 209;
    ( ( uint8_t * ) & encoding_rnd[0] )[13] = 48;
    ( ( uint8_t * ) & encoding_rnd[0] )[14] = 203;
    ( ( uint8_t * ) & encoding_rnd[0] )[15] = 91;
    ( ( uint8_t * ) & encoding_rnd[0] )[16] = 190;
    ( ( uint8_t * ) & encoding_rnd[0] )[17] = 203;
    ( ( uint8_t * ) & encoding_rnd[0] )[18] = 14;
    ( ( uint8_t * ) & encoding_rnd[0] )[19] = 18;
    ( ( uint8_t * ) & encoding_rnd[0] )[20] = 194;
    ( ( uint8_t * ) & encoding_rnd[0] )[21] = 123;
    ( ( uint8_t * ) & encoding_rnd[0] )[22] = 23;
    ( ( uint8_t * ) & encoding_rnd[0] )[23] = 9;
    ( ( uint8_t * ) & encoding_rnd[0] )[24] = 133;
    ( ( uint8_t * ) & encoding_rnd[0] )[25] = 249;
    ( ( uint8_t * ) & encoding_rnd[0] )[26] = 246;
    ( ( uint8_t * ) & encoding_rnd[0] )[27] = 171;
    ( ( uint8_t * ) & encoding_rnd[0] )[28] = 159;
    ( ( uint8_t * ) & encoding_rnd[0] )[29] = 103;
    ( ( uint8_t * ) & encoding_rnd[0] )[30] = 5;
    ( ( uint8_t * ) & encoding_rnd[0] )[31] = 17;

#if ( XRN_SKIP_CONFIGURATION_PROMPT == 0 )

    printf( "\n" );
    printf( "                                                          \n" );
    printf( "                 Xoron library compilation utility        \n" );
    printf( "                                                          \n" );
    printf( "\nthis utility is used to generate/restore your own Xoron cryptography library.\n\n" );

    ret = permutation_compilation_settings( permutation_rnd );
    if ( ret != XSUCCESS ) {
        printf( "compilation failed\n" );
    }

    ret = encoding_compilation_settings( encoding_rnd );
    if ( ret != XSUCCESS ) {
        printf( "compilation failed\n" );
    }

    printf( "press enter to continue " );
    while ( getchar(  ) != '\n' );

#endif

    ret = print_permutation_compilation_settings( permutation_rnd, permutation_settings_fp );
    if ( ret != XSUCCESS ) {
        printf( "compilation failed\n" );
    }

    ret = print_encoding_compilation_settings( encoding_rnd, encoding_settings_fp );
    if ( ret != XSUCCESS ) {
        printf( "compilation failed\n" );
    }

    return XSUCCESS;

}

